package com.poly_.polyparameter_;

public class PolyParameter {
    public static void main(String[] args) {
        Staff jack = new Staff("jack", 6000);
        Manager mary = new Manager("mary", 7000, 1000);
        PolyParameter polyParameter = new PolyParameter();
        polyParameter.showEmpAnnual(jack);
        polyParameter.showEmpAnnual(mary);
        polyParameter.testWork(jack);
        polyParameter.testWork(mary);
    }

    public void showEmpAnnual(Employee e){
        System.out.println(e.getAnnual());
    }
    public void testWork(Employee e){
        if (e instanceof Staff){
            ((Staff) e).work();
        }else if (e instanceof Manager){
            ((Manager)e).manage();
        }else {
            System.out.println("对象运行类型错误");
        }

    }
}

